<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    div{
      width: 100px;
      height: 100px;
      background: red;
    }
  </style>
</head>
<body>
  <!-- 
    hide() 
      隐藏
    show()
      显示
    toggle() 
      切换显示隐藏

    显示隐藏默认是立即生效的，如果要添加时间，则会有淡出并伴有宽高缩小的效果
      
   -->
  <button>按钮</button>
  <hr>
  <div></div>
  <script src="../libs/jquery-1.12.4.js"></script>
  <script>
    $(function () {
      $('button').on('click', function () {
        // $('div').css('display', 'none')
        $('div').toggle(1000, function () {
          alert('动画结束')
        })
      })


    })
  </script>
</body>
</html>